<ion-view class="bg">
  <ion-header-bar class="bar bar-positive">
    <button class="button back-button buttons icon ion-ios-arrow-left button-clear" ng-if="htmlId==''" nav-direction="back" ui-sref="tab.workbench">返回</button>
    <button class="button back-button buttons icon ion-ios-arrow-left button-clear" ng-if="htmlId=='addWaybill'" nav-direction="back" ui-sref="addWaybill">返回</button>
    <h3 class="title">我的订单</h3>
    <button class="button button-icon icon ion-ios-search" ng-click="modal.show()"></button>
  </ion-header-bar>
  <ion-content>
    <ion-refresher pulling-text="下拉刷新..." on-refresh="doRefresh()"></ion-refresher>
    <div ng-if="showloading" class="ion-spinner">
      <ion-spinner icon="lines" class="spinner-calm"></ion-spinner>
    </div>
    <ion-list class="myList" ng-if="showloading == false">
      <h5 ng-if="orderData==''" class="notFound">未找到数据</h5>
      <li class="item li" ng-click="goOrderDetail(data,data.ORDER_TYPE)" ng-repeat="data in orderData">
        <div>
          <i>订单编号</i>
          <i class="value" style="color: #11c1f3">{{data.ORDER_NO}}</i>
        </div>
        <img src="img/orderState-{{data.ORDER_STATUS}}.png" class="stateImg">
        <div>
          <i>下单时间</i>
          <i class="value">{{data.CREATE_DATE | date : "yyyy-MM-dd HH:mm:ss"}}</i>
        </div>
        <div>
          <i>订单类型</i>
          <i class="value" ng-if="data.ORDER_TYPE=='0'">APP订单</i>
          <i class="value" ng-if="data.ORDER_TYPE=='1'">客服订单</i>
          <i class="value" ng-if="data.ORDER_TYPE=='2'">中转订单</i>
          <i class="value" ng-if="data.ORDER_TYPE=='3'">网络订单</i>
        </div>
        <div ng-if="data.GOODS_NAME!=null">
          <i>{{data.GOODS_NAME}}</i>
          <i class="value">{{data.PIECES}}件</i>
        </div>
        <div>
          <i>声明价值</i>
          <i class="value" ng-if="data.DECLARE_VALUE!=undefined">{{data.DECLARE_VALUE | number:2}}元</i>
          <i class="value" ng-if="data.DECLARE_VALUE==undefined">0.00元</i>
        </div>
        <div>
          <i>订单提货费</i>
          <i class="value" ng-if="data.PICK_UP_COST!=undefined">{{data.PICK_UP_COST | number:2}}元</i>
          <i class="value" ng-if="data.PICK_UP_COST==undefined">0.00元</i>
        </div>
        <div ng-if="data.ORDER_STATUS==0">
          <button class="button button-light leftButton" ng-click="operationOrder(data.ID,'2');$event.stopPropagation();">拒绝</button>
          <button class="button button-positive rightButton" ng-click="operationOrder(data.ID,'1');$event.stopPropagation();">受理</button>
        </div>
        <div class="btnDiv" ng-if="data.ORDER_STATUS==1&&data.DELIVERY_WAYBILL_STATUS<=1">
          <button class="button button-positive longButton" ng-click="singleTurn(data.ID,data.ORDER_TYPE);$event.stopPropagation();" style="width: 80%;">转单</button>
        </div>
      </li>
    </ion-list>
    <ion-infinite-scroll on-infinite="loadMore()" distance="1%" ng-if="hasNextPage()"></ion-infinite-scroll>
  </ion-content>
</ion-view>
